package org.ls.petclinic.web;

import org.ls.petclinic.dao.VetDao;
import org.ls.petclinic.dao.impl.VetDaoImpl;
import org.ls.petclinic.untils.JdbcUtils;
import org.ls.petclinic.untils.WebUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Description
 * @Author 浪矢先生
 * @Create 2022-06-09 23:40
 */
@WebServlet(urlPatterns = "/deleteVet")
public class DeleteVetServlet extends BaseServlet{
    private VetDao vetDao=new VetDaoImpl();
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        vetDao.deleteVetById( WebUtils.parseInt(id, 0));
        JdbcUtils.commitAndClose();
    }
}
